#if UNITY_IPHONE_API

using System;
using System.Collections;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

namespace UnityEngine
{
public sealed partial class iPhone
{
	[System.Runtime.InteropServices.DllImport("__Internal")]
	internal static extern void UnityNSObject_RetainObject(IntPtr obj);

	[System.Runtime.InteropServices.DllImport("__Internal")]
	internal static extern void UnityNSObject_ReleaseObject(IntPtr obj);

	public sealed partial class NSError
	{
 		[System.Runtime.InteropServices.DllImport("__Internal")]
		private static extern int UnityNSError_Code(IntPtr errorObj);

 		[System.Runtime.InteropServices.DllImport("__Internal")]
		private static extern IntPtr UnityNSError_Description(IntPtr errorObj);

 		[System.Runtime.InteropServices.DllImport("__Internal")]
		private static extern IntPtr UnityNSError_Reason(IntPtr errorObj);


		private IntPtr _nativeError;
		private NSError(IntPtr nativeError)
		{
			_nativeError = nativeError;
			UnityNSObject_RetainObject(_nativeError);
		}
		~NSError()
		{
			UnityNSObject_ReleaseObject(_nativeError);
		}

		public static NSError CreateNSError(IntPtr nativeError)
		{
			return nativeError == IntPtr.Zero ? null : new NSError(nativeError);
		}

		public int code
		{
			get { return UnityNSError_Code(_nativeError); }
		}
		public string description
		{
			get { return Marshal.PtrToStringAnsi(UnityNSError_Description(_nativeError)); }
		}
		public string reason
		{
			get { return Marshal.PtrToStringAnsi(UnityNSError_Reason(_nativeError)); }
		}
	}

	public sealed partial class NSNotification
	{
 		[System.Runtime.InteropServices.DllImport("__Internal")]
		private static extern IntPtr UnityNSNotification_Name(IntPtr notificationObj);

		private IntPtr _nativeNotification;
		private NSNotification(IntPtr nativeNotification)
		{
			_nativeNotification = nativeNotification;
			UnityNSObject_RetainObject(_nativeNotification);
		}
		~NSNotification()
		{
			UnityNSObject_ReleaseObject(_nativeNotification);
		}

		public static NSNotification CreateNSNotification(IntPtr nativeNotification)
		{
			return nativeNotification == IntPtr.Zero ? null : new NSNotification(nativeNotification);
		}

		public string name
		{
			get { return Marshal.PtrToStringAnsi(UnityNSNotification_Name(_nativeNotification)); }
		}
	}
}
}

#endif
